<template>
	<view class="mainbgc">
		<!-- 头部 -->
		<view class="header-box">
			<view class="header" @click="thelogin('/pages/login/accountlogin')">
				<view class="needposi flexbetween">
					<view class="flexleft" v-if="isLogin">
						<view class="headimage">
							<image :src="userInfo.avatar_text" mode=""></image>
						</view>
						<view>
							<view class="userinfo">{{userInfo.username}}（{{userInfo.mobile}}）</view>
							<!-- <view class="gongsi">{{userlist.company_info.company_name}}</view> -->
						</view>
					</view>
					<view class="flexleft" v-if="!isLogin">
						<view class="headimage">
							<image src="../../static/image/news/news3.png" mode=""></image>
						</view>
						<view>
							<view class="userinfo">未登录，点击登录</view>
						</view>
					</view>
					<view class="righticon2" v-if="!isLogin"></view>
				</view>
			</view>
		</view>
		<view class="mainpadding2">
			<view class="ffffff radius margin_top">
				<!-- <view class="mainpadding flexbetween neeedborder" @click="jumpurl('/pages/mypage/dianpuxx')">
					<view class="flexleft">
						<view class="lefticon margin_right">
							<image src="../../static/image/system/my1.png" mode=""></image>
						</view>
						<view class="nostrongtext">店铺信息</view>
					</view>
					<view class="righticon2"></view>
				</view> -->
				<view class="mainpadding flexbetween neeedborder" @click="jumpurl('/pages/mypage/gerenxx')">
					<view class="flexleft">
						<view class="margin_right">
							<u-icon name="account" size="22"></u-icon>
						</view>
						<view class="nostrongtext">个人信息</view>
					</view>
					<view class="righticon2"></view>
				</view>
				<view class="mainpadding flexbetween neeedborder" @click="jumpurl('/pages/mypage/bangdingdyj')">
					<view class="flexleft">
						<view class="margin_right">
							<u-icon name="wifi" size="22"></u-icon>
						</view>
						<view class="nostrongtext">云打印机</view>
					</view>
					<view class="righticon2"></view>
				</view>
				<view class="mainpadding flexbetween neeedborder" @click="jumpurl('/pages/mypage/dayinjsz')">
					<view class="flexleft">
						<view class="lefticon margin_right">
							<u-icon name="coupon" size="22"></u-icon>
							<!-- <image src="../../static/image/system/my2.png" mode=""></image> -->
						</view>
						<view class="nostrongtext">蓝牙打印机</view>
					</view>
					<view class="righticon2"></view>
				</view>
				<view class="mainpadding flexbetween neeedborder" @click="jumpurl('/pages/mypage/tuiguangm')">
					<view class="flexleft">
						<view class="margin_right">
							<u-icon name="grid" size="22"></u-icon>
						</view>
						<view class="nostrongtext">小程序推广码</view>
					</view>
					<view class="righticon2"></view>
				</view>
				<view class="mainpadding flexbetween neeedborder" @click="jumpurl('/pages/mypage/set')">
					<view class="flexleft">
						<view class="margin_right">
							<u-icon name="setting" size="22"></u-icon>
						</view>
						<view class="nostrongtext">设置</view>
					</view>
					<view class="righticon2"></view>
				</view>
				<!-- <view class="mainpadding flexbetween neeedborder" @click="clearstorage">
					<view class="flexleft">
						<view class="margin_right">
							<u-icon name="setting" size="22"></u-icon>
						</view>
						<view class="nostrongtext">清楚</view>
					</view>
					<view class="righticon2"></view>
				</view> -->
			</view>
		</view>
		<view class="logoposition flexcolumn">
			<view class="logotoptext">{{systemInfo.gs_name}}</view>
			<view class="flexcenter" style="margin-top: 10rpx;" @click="phone(systemInfo.gs_tel)">
				<view class="phoneicon2"></view>
				<view class="logobottomtext">{{systemInfo.gs_tel}}</view>
			</view>
		</view>
		<tabbar current=3></tabbar>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				mapvalue: true,
				userInfo:{},
				isLogin:false,
				systemInfo:{},
			}
		},
		onLoad() {
			this.isLogin = httpRequest.checkIsLogin()
			uni.hideTabBar(); //隐藏tab
			this.getSystem()
		},
		onShow() {
			this.getInfo()
		},
		methods: {
			clearstorage(){
				uni.clearStorage()
			},
			getSystem() {
				httpRequest.request('/employeesapi/index/getConfigInfo', 'POST', {
				}, false, false, true).then(res => {
					this.systemInfo = res.data
				})
			},
			// 用户信息
			getInfo() {
				httpRequest.request('/dhtapi/user/index', 'POST', {}).then(res => {
					this.$store.state.userInfo = res.data
					this.userInfo = res.data
				}).catch(err => {
					httpRequest.toast(err.msg)
				})
			},
			jumpurl(url){
				// 如果用户未登录点击去登陆
				if (!httpRequest.checkIsLogin()) {
					httpRequest.doLogin();
					return false;
				}
				uni.navigateTo({
					url:url
				})
			},
			thelogin(url){
				if(this.isLogin){
					return
				}
				uni.navigateTo({
					url:url
				})
			},
			phone(p) {
				uni.makePhoneCall({
					phoneNumber: p.toString()
				}).catch((e) => {
					// console.log(e)  //用catch(e)来捕获错误{makePhoneCall:fail cancel}
				})
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	.header-box {
		height: 230rpx;
		width: 100%;
	}
	
	.header {
		/* #ifdef APP-PLUS */
		
		/* #endif */
		/* #ifdef MP-WEIXIN */
		background-color: #0BBDCB;
		/* #endif */
		width: 100%;
		// height: 376rpx;
		background-size: 100% 100%;
	}
	
	.needposi {
		width: 100%;
		position: fixed;
		box-sizing: border-box;
		top: 0;
		padding: 100rpx 30rpx 10rpx 30rpx;
		left: 0;
		z-index: 100;
		background-image: url("@/static/image/system/headerbgc.png");
		background-size: 100% 100%;
		// background-color: #0BBDCB;
	}
	
	.needtop {
		position: relative;
		bottom: 130rpx;
	}
	
	.needbotborder {
		border-bottom: 1rpx solid #e9e9e9;
	}
	
	.headimage {
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
		margin-right: 15rpx;
		image {
			border-radius: 50%;
			width: 100%;
			height: 100%;
		}
	}
	
	.userinfo {
		font-size: 36rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #333;
	}
	
	.gongsi {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #333;
	}
	// 内容开始
	.lefticon{
		width: 33rpx;
		height: 32rpx;
		image{
			width: 100%;
			height: 100%;
		}
	}
	.neeedborder{
		border-bottom: 1rpx solid rgba(200, 200, 200, .06);
	}
	.logoposition{
		position: absolute;
		bottom: 200rpx;
		left: 0;
		width: 100%;
	}
	.nostrongtext{
		font-weight: 500;
		font-size: 36rpx;
	}
</style>

